﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Example13.aspx.cs" Inherits="Chapter28.Example13" %>

<!DOCTYPE html>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>代码清单 28-13 比较元素对象</title>
    <meta name="author" content="Adam Freeman" />
    <meta name="description" content="A simple example" />
    <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
    <style>
        table {
            border: solid thin black;
            border-collapse: collapse;
        }

        td {
            padding: 4px 5px;
        }
    </style>
</head>
<body>
    <table border="1">
        <thead>
            <tr>
                <th>Fruit</th>
                <th>Color</th>
            </tr>
        </thead>
        <tbody id="fruitsBody">
            <tr>
                <td id="plumrow">Plum</td>
                <td>Purple</td>
            </tr>
        </tbody>
    </table>
    <pre id="results"></pre>
    <script>
        var elemById = document.getElementById("plumrow");
        var elemByPos = document.getElementById("fruitsBody").getElementsByTagName("tr")[0].cells[0];
        if (elemById.isSameNode(elemByPos)) {
            document.getElementById("results").innerHTML = "Objects are the same";
        }
    </script>
</body>
</html>
